﻿@model hnrzxt.Models.Org

@{
    ViewData["Title"] = "Edit";
}

@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>华南人资系统</title>
    <link rel="stylesheet" href="~/layui/css/layui.css">
</head>
<body>
    <style type="text/css">
        #dept_main, #dept_particulars {
            width: 48.5%;
            display: inline-block;
            vertical-align: top;
            padding: 20px;
            background: white;
            box-sizing: border-box;
        }

        #dept_tree {
            margin-top: 20px;
        }

        .layui-form-label {
            width: auto
        }

    </style>

    <div class="row">
        <div class="col-md-8">
                <form asp-action="Edit" class="layui-form" lay-filter="hnhr">
                <div asp-validation-summary="ModelOnly" class="text-danger"></div>
                <input type="hidden" asp-for="id" />

                <input type="hidden" asp-for="ParentOrgId" />
                <div class="layui-form-item">
                    <label class="control-label layui-form-label">上级组织</label>                        
                    <div class="layui-input-block">
                        <input name="ParentOrg" class="form-control layui-input" />
                        <span class="text-danger"></span>
                    </div>
                </div>

                <input type="hidden" asp-for="OrgId" />
                <div class="layui-form-item">
                    <label asp-for="OrgName" class="control-label layui-form-label">组织名称</label>
                     <div class="layui-input-block">
                         <input asp-for="OrgName" class="form-control layui-input" />
                        <span asp-validation-for="OrgName" class="text-danger"></span>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label asp-for="Deptor" class="control-label layui-form-label">部门负责人</label>
                    <div class="layui-input-block">
                        <input asp-for="Deptor" class="form-control layui-input" />
                        <span asp-validation-for="Deptor" class="text-danger"></span>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label asp-for="WebUrl" class="control-label layui-form-label">URL</label>
                    <div class="layui-input-block">
                        <input asp-for="WebUrl" class="form-control  layui-input" />
                        <span asp-validation-for="WebUrl" class="text-danger"></span>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label asp-for="Icon" class="control-label layui-form-label">图标</label>
                    <div class="layui-input-block">
                        <input asp-for="Icon" class="form-control  layui-input" />
                        <span asp-validation-for="Icon" class="text-danger"></span>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label asp-for="Remark" class="control-label layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <input asp-for="Remark" class="form-control  layui-input" />
                        <span asp-validation-for="Remark" class="text-danger"></span>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label asp-for="Sort" class="control-label layui-form-label">排序</label>
                    <div class="layui-input-block">
                        <input asp-for="Sort" class="form-control  layui-input" />
                        <span asp-validation-for="Sort" class="text-danger"></span>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label asp-for="StopFlag" class="control-label layui-form-label">停用标志</label>
                    <div class="layui-input-block">
                        <input asp-for="StopFlag" class="form-control  layui-input" />
                        <span asp-validation-for="StopFlag" class="text-danger"></span>
                    </div>
                </div>

                <div class="layui-form-item">
                    <input type="submit" value="保存" class="btn btn-primary" />
                </div>
            </form>
        </div>
    </div>

    <script src="~/layui/layui.js"></script>
    <script>
        layui.use(['form', 'util', 'laydate', 'tree'], function () {
            var form = layui.form;
            var layer = layui.layer;
            var util = layui.util;
            var laydate = layui.laydate;
            var tree = layui.tree;

            form.val('hnhr', {
                "ParentOrg": GetOrgInfo(@Html.DisplayFor(model => model.ParentOrgId))
                //"deptorName": obj.data.deptor,//GetYGInfo(obj.data.deptor),

            });

        });

        function GetOrgInfo(OrgId) {
            var data = "";
            $.ajax({
                url: "/TreeData/GetOrgInfo",
                type: "post",
                data: { "OrgId": OrgId },
                async: false,
                success: function (resut) {
                    data = resut;
                }
            });
            return data;
        }

    </script>
</body>
</html>
